package Practice;

import java.util.Arrays;
import java.util.Scanner;

public class Mingming {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] a = new int[n];
        for (int i = 0; i < a.length; i++) {
            a[i] = sc.nextInt();
        }
        Arrays.sort(a);
        int[] b = new int[n];
        int count = 0;
        for (int j = 0; j < n-1; j++) {
            if (j == n-2){
                if (a[j] != a[j+1]){
                    b[j+1] = a[j+1];
                }
            }
            if (a[j] == a[j+1]){
                count++;
            }
            else {
                b[j] = a[j];
            }
        }
        Arrays.sort(b);
        System.out.println(n-count);
        for (int k = count; k < n; k++) {
            System.out.print(b[k]+" ");
        }
    }
}
